import  BaseUtils from './BaseUtils'

export default {
  mixins: [ BaseUtils],
  props: {
    value: {
      type: Object,
      default: () => {
        return {}
      }
    }
  },
  data() {
    return {
      queryParams: {
        keywords: '',
      },
    }
  },
  mounted() {
    this.init()
  },
  watch: {
    value() {
      this.init()
    },
    queryParams: {
      handler: function () {
        this.doChange()
      },
      deep: true
    }
  },
  methods: {
    init() {
      for(let key in this.value) {
        this.$set(this.queryParams, key, this.value[key])
      }
    },
    doChange() {
      this.$emit("onChange", this.queryParams)
    },
  }
}